package com.marsproj.bankingmanagesystem.entity;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

@Data
@ApiModel("账户")
public class Account {

    @ApiModelProperty("账号")
    private String uid;

    @ApiModelProperty("账户名")
    private String name;

    @ApiModelProperty("余额")
    private BigDecimal money;

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("备注")
    private String remark;

    public Account() {
        this.createTime = new Date();
    }

    public Account(String uid, String name, String money) {
        this(uid, name, money, null);
    }

    public Account(String uid, String name, String money, String remark) {
        this(uid, name, money, new Date(), remark);
    }

    public Account(String uid, String name, String money, Date date, String remark) {
        this.uid = uid;
        this.name = name;
        this.money = new BigDecimal(money);
        this.createTime = date;
        this.remark = remark;
    }

}
